package com.boot.unity.api.modules.training.controller;

import com.boot.unity.api.common.Result;
import com.boot.unity.api.modules.training.entity.Region;
import com.boot.unity.api.modules.training.service.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

//@Api(tags = "驾校-培训机构教学区域")
//@RestController
//@RequestMapping("/api/region")
@AllArgsConstructor
public class RegionController {
    private final RegionService regionService;

    @ApiOperation(value = "新增修改教学区域接口")
    @PostMapping
    public Result save(@RequestBody Region region) {
        return regionService.save(region);
    }

    @ApiOperation(value = "删除教学区域")
    @DeleteMapping("/{inscode}-region-{seq}")
    public Result delete(@PathVariable("inscode") String inscode, @PathVariable("seq") String seq) {
        return regionService.deleteByInscodeAndSeq(inscode,seq);
    }

//    @GetMapping("/{id}")
//    @ApiOperation(value = "根据id获取")
//    public Region get(@PathVariable Long id) {
//        return regionDao.getById(id);
//    }
//
//    @PutMapping
//    @ApiOperation(value = "修改")
//    public Region update(@RequestBody Region region) {
//        regionDao.update(region);
//        return region;
//    }
//
//    @GetMapping
//    @ApiOperation(value = "列表")
//    public PageTableResponse list(PageTableRequest tableRequest) {
//        return new PageTableHandler(
//            request -> regionDao.count(request.getParams()),
//            request -> regionDao.list(request.getParams(), request.getOffset(), request.getLimit())
//        ).handle(tableRequest);
//    }
//

}
